//import Beans.MyBeanClass;
import Beans.Course;
import Beans.Student;
import Beans.Teacher;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.naming.Context;

public class MainApp {
    public static void main(String[] args) {
        ApplicationContext context=new ClassPathXmlApplicationContext("Application.xml");
//        MyBeanClass myBean=(MyBeanClass) context.getBean("myBean");
//        MyBeanClass myBean1=context.getBean("myBean",MyBeanClass.class);
//        MyBeanClass myBean2=context.getBean(MyBeanClass.class);
//        System.out.println(myBean1);
//        Student wangwu = context.getBean("wangwu", Student.class);
//        Student xiaowang = context.getBean("xiaowang", Student.class);
//        System.out.println(wangwu);
//        System.out.println(xiaowang);
        //setter注入
        Student lisi = context.getBean("lisi", Student.class);
        System.out.println(lisi);
        //构造器注入
//        Teacher w = context.getBean("w", Teacher.class);
//        System.out.println(w);
//        p命名空间
//        Course cc = context.getBean("c01", Course.class);
//        System.out.println(cc.getCname());
    }
}
